using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameOver : MonoBehaviour
{
    // 标记是否已经Game Over，避免重复触发
    private bool isGameOver = false;

    // 游戏结束UI面板
    public GameObject gameOverUI; //GameObject 可以把物体拖进来 面向对象opo

    // 当角色碰到地面时触发
    private void OnCollisionEnter(Collision collision)
    {
        // 假设地面的Tag为 "Ground"
        if (!isGameOver && collision.gameObject.CompareTag("Ground"))
        {
            isGameOver = true;
            Time.timeScale = 0f; // 暂停游戏时间
            if (gameOverUI != null)
            {
                gameOverUI.SetActive(true); // 显示游戏结束UI
            }
            Debug.Log("GAME OVER!");
        }
    }
}
